package com.cw.maintenance.action;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;
import javax.swing.JOptionPane;

import com.cw.maintenance.AddDataDialog;
import com.cw.maintenance.MaintenancePanel;

public class InsertAction extends AbstractAction {
	MaintenancePanel target;

	public InsertAction(String name, Icon icon, MaintenancePanel tar) {
		super(name, icon);
		this.target = tar;
	}

	public void actionPerformed(ActionEvent e) {
		int comfirm = JOptionPane.showInternalConfirmDialog(target,
				"Are sure add records?", "Comfirm?",
				JOptionPane.OK_CANCEL_OPTION);
		if (comfirm == JOptionPane.CANCEL_OPTION) {
			return;
		}
		// Object result = JOptionPane.showInternalOptionDialog(target,"select a
		// value","input",2,2,null,new String[]{"a","b"},new JTable());
		// System.out.println("result is:"+result);
		//
		AddDataDialog insertd = new AddDataDialog(target, "insert ", true);
		insertd.showInsertDialog();
	}
}
